package com.monitoring.management.common.utils.assembler;

import com.monitoring.management.core.command.LoginCommand;
import com.monitoring.management.core.command.RegisterCommand;
import com.monitoring.management.core.dto.UserDTO;
import org.springframework.beans.BeanUtils;

/**
 * Created by liujunnan on 2017/6/6.
 */
public class UserAssembler {
    public static UserDTO toUserDTO(LoginCommand loginCommand) {
        UserDTO dto = new UserDTO();
        BeanUtils.copyProperties(loginCommand, dto);
        return dto;
    }
    /**
     * 将注册命令转化为UserDTO
     * @param registerCommand
     * @return
     */
    public static UserDTO toUserDTO(RegisterCommand registerCommand) {
        UserDTO dto = new UserDTO();
        BeanUtils.copyProperties(registerCommand, dto);
        return dto;
    }

}
